<template>
	<view class="">
		<u-form-item :label="item.label" borderBottom ref="item1" :prop="item.value" :required="item.required">
			<!-- <view  >{{ inputValue }}</view> -->
			<view @click="!disabled && (show = true)" style="flex: 1; padding: 0; min-height: 40rpx" ref="formitem">
				{{ showvalue }}
			</view>
			<!-- :class="[value ? 'uni-input-input' : 'select-wrap']" -->
		</u-form-item>
		<!-- datePicker -->
		<u-datetime-picker :show="show" v-model="inputValue" mode="date" @confirm="show = false" @cancel="show = false"
			@close="show = false"></u-datetime-picker>
	</view>
</template>

<script>
	export default {
		mixins: [uni.$u.mpMixin, uni.$u.mixin],
		props: {
			item: {
				typeof: Object,
				default: () => {
					return {};
				},
			},
			data: {
				typeof: Object,
				default: () => {
					return {};
				},
			},
			value: {
				typeof: [String, Number, Boolean, Array, Object],
				default: () => {
					return "";
				},
			},
		},
		data() {
			return {
				// inputValue: "",
				show: false,
			};
		},
		computed: {
			disabled() {
				this.getParentData("u-form")
				return this.parent.disabled;
			},
			showvalue() {
				if (!this.value || this.value == "0") {
					return "请选择";
				}
				return this.$u.timeFormat(new Date(Number(this.value)));
			},
			inputValue: {
				get() {
					if (!this.value || this.value == "0") {
						return Number(new Date());
					}
					return Number(new Date(Number(this.value)));
				},
				set(val) {
					val = String(val);
					this.$emit("input", val);
					uni.$u.formValidate(this.$refs.formitem, "blur");
				},
			},
		},

		methods: {},
	};
</script>

<style scoped lang="scss">
	.uni-input-input {
		font-size: 14px !important;
		color: #171a1d !important;
		line-height: 99rpx !important;
		height: 99rpx !important;
		padding-left: 10px;
	}

	.uni-forms-item__label {
		margin-left: 0;
		font-size: 14px !important;
		color: #171a1d !important;
		line-height: 99rpx !important;
		height: 99rpx !important;
	}
</style>